<?php

require('../fpdf16/fpdf.php');
require('config.php');

$header = array('Product', 'Product Description', 'Unit Price', 'Quantity', 'Total');
$data = $cartOutput;

//create_receipt($header1,$data1);

$pdf= new FPDF();
$pdf->AddPage();

$pdf->Image('../css/images/logo.gif',0,0,0,0);
$pdf->SetFont('Arial','B',19);
$pdf->Cell(156,64,'test',0,10,'C');

$pdf->SetXY(35,35);
$pdf->Cell(0,0,$header,0,10,'C');
$pdf->Ln(10);

$pdf->Output("Invoice.pdf","I");

class PDF extends FPDF {

	function header() {
		
		$this->Image('../css/images/logo.gif',0,0,220,0);
		$this->SetFont('Arial','B',19);
		
		$this->SetXY(35,35);
		$this->Cell(0,0,'Luvo Fashion',0,1,'C');
		$this->Ln(10);
		
	}

	function create_receipt($header, $data) {
		
		//Column widths
		$w=array(40,35,40,45);
		//Header
		for($i=0;$i<count($header);$i++)
			$this->Cell($w[$i],7,$header[$i],1,0,'C');
		$this->Ln();
		//Data
		foreach($data as $row) {
			$this->Cell($w[0],6,$row[0],'LR');
			$this->Cell($w[1],6,$row[1],'LR');
			$this->Cell($w[2],6,number_format($row[2]),'LR',0,'R');
			$this->Cell($w[3],6,number_format($row[3]),'LR',0,'R');
			$this->Ln();
		}
		//Closure line
		$this->Cell(array_sum($w),0,'','T');
		Output();
	}
		
}
?>